package cn.tx.tag;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import cn.tx.util.KVConstants;

public class ErpTag extends TagSupport {
	
	
	private String type;
	
	private Integer value;
	
	
	
	
	
	public Integer getValue() {
		return value;
	}



	public void setValue(Integer value) {
		this.value = value;
	}



	public String getType() {
		return type;
	}



	public void setType(String type) {
		this.type = type;
	}



	@Override
	public int doStartTag() throws JspException {
		//获得一个向jsp中些文本的对象
		JspWriter out = pageContext.getOut();
		
		try {
			if(type.equals(KVConstants.GENDER)){
				switch(value.intValue()){
					case 1:
						out.print("男");
						break;
					case 2:
						out.print("女");
						break;
				}
			}
			if(type.equals(KVConstants.NEEDS)){
				switch(value.intValue()){
				case 1:
					out.print("送货");
					break;
				case 2:
					out.print("自提");
					break;
				}
			}
			
			if(type.equals(KVConstants.ORDER_STATE)){
				switch(value.intValue()){
				case 1:
					out.print("未审核");
					break;
				case 2:
					out.print("已审核");
					break;
				case 3:
					out.print("审核不通过");
					break;
				case 4:
					out.print("采购中");
					break;
				case 5:
					out.print("已结单");
					break;
				}
			}
			if(type.equals(KVConstants.ORDER_TYPE)){
				switch(value.intValue()){
				case 1:
					out.print("采购单");
					break;
				case 2:
					out.print("运输单");
					break;
				case 3:
					out.print("入库单");
					break;
				case 4:
					out.print("出库单");
					break;
				case 5:
					out.print("销售单");
					break;
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return super.doStartTag();
	}

}
